package com.ctgu.project01.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName TokenConfig
 * @Author Alex2
 * @Date 2025/2/26 11:01
 **/
@Configuration
public class TokenConfig implements WebMvcConfigurer {

    private final TokenInterceptor tokenInterceptor;

    public TokenConfig(TokenInterceptor tokenInterceptor) {
        this.tokenInterceptor = tokenInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .excludePathPatterns("/api/users/session/**");
    }
}